export function _css(el: any, key: any, value?: any) {
  const reg = /^-?\d+.?\d*(px|pt|em|rem|vw|vh|%|rpx|ms)$/i;
  if (value === undefined) {
    let val = null;
    if ("getComputedStyle" in window) {
      val = window.getComputedStyle(el, null)[key];
    } else {
      val = el.currentStyle[key];
    }
    return reg.test(val) ? parseFloat(val) : val;
    // return parseFloat(val)
  } else {
    if (
      [
        "top",
        "left",
        "bottom",
        "right",
        "width",
        "height",
        "font-size",
        "margin",
        "padding",
      ].includes(key)
    ) {
      if (!reg.test(value)) {
        if (!String(value).includes("calc")) {
          value += "px";
        }
      }
    }
    // console.log(value)
    if (key === "transform") {
      //直接设置不生效
      el.style.webkitTransform =
        el.style.MsTransform =
        el.style.msTransform =
        el.style.MozTransform =
        el.style.OTransform =
        el.style.transform =
          value;
    } else {
      el.style[key] = value;
    }
  }
}
export function set_app_title(title: string) {
  if (isEmptyType(title)) {
    return;
  }
  document.title = title;
}
export function isEmptyElement(element: { innerHTML: any }) {
  if (element) {
    return isEmptyType(element.innerHTML);
  } else {
    return true;
  }
}
